<?php
	if ($_SERVER['REQUEST_METHOD'] == 'POST') {
		error_reporting(E_ALL & ~E_NOTICE);
	
		session_start();
		
	 	require_once 'functions.php';
		
		$username = clean($_POST['username']);
		$password = clean($_POST['password']);
			
		$result = query("SELECT * FROM user WHERE username = '$username' AND password = '$password'", true);
	
		if($result) {
			$_SESSION['login'] = $result['id'];			
	
			loadPage('usercontrol');
		}else {
			loadPage('admin');
		}
	}
?>

